﻿@model PagedList.IPagedList<XichLoGreen.Models.NewsModel>
@using System.Data.Entity;
@{
    ViewBag.Title = "SearchResult";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script src="@Url.Content("~/Scripts/Search.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/Search.css")" rel="stylesheet" type="text/css" />
<link href="../../Content/PagedList.css" type="text/css" rel="stylesheet" />
<div id="contentInnerWrapper">
    <div id="contentColWrapper">

        <div id="content" class="theme1">

            <div class="plain_text">
                <div id="sliSearchBox">
                    <form action="@Url.Action("SearchResult", "Home")" method="GET">

                        <fieldset>
                            <label>Keywords&nbsp;&nbsp;</label><input name="searchkey" id="w" class="text" type="text" size="50" value="@Session["Key"]" />
                            <input src="@Url.Content("~/Content/img/search-icon.png")" value="Go" class="go" type="image">
                        </fieldset>
                    </form>
                </div>
                <div id="su">
                    <input  id="123"type="text" size="5" value="@Session["SL"]" />
                    <font color="black"><b>@Session["SL"]</b></font> <strong>results</strong> for "<font color="black"><b>@Session["Key"]</b></font>"                        
                </div>
                <div class="sliSuggestions"></div>
                <div id="sliResults">
                    @if (Model != null)
                    {
                        for (var i = 0; i < Model.Count; i++)
                        {
                           
                            if (i % 2 == 0)
                            {
                        <div class="sliResult odd">
                            <div class="sliImage">
                            </div>
                            <div class="sliItem">
                                <h2><a href="#" title="@Html.DisplayFor(modelItem => item.Title)">@Html.DisplayFor(modelItem => item.Title)</a></h2>
                                <p class="sliDesc">@Html.DisplayFor(modelItem => item.Summary)</p>

                            </div>
                            <div class="clear"></div>
                        </div> 
                            }
                            else
                            {
                        <div class="sliResult even">
                            <div class="sliImage">
                            </div>
                            <div class="sliItem">
                                <h2><a href="#" title="@Html.DisplayFor(modelItem => item.Title)">@Html.DisplayFor(modelItem => item.Title)</a></h2>
                                <p class="sliDesc">@Html.DisplayFor(modelItem => item.Summary)</p>

                            </div>
                            <div class="clear"></div>
                        </div> 
                            }
                        }
                    }
                </div>

                @if (Model != null)
                {
                    <div style="float: right" id="PageList">
                        Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
                        of @Model.PageCount
                        &nbsp;
	                @if (Model.HasPreviousPage)
                 {
                        @Html.ActionLink("<<", "SearchResult", new { page = 1 })
                        @Html.Raw("&nbsp;");
                        @Html.ActionLink("< Prev", "SearchResult", new { page = Model.PageNumber - 1 })
                 }
                 else
                 {
                        @:<<
                        @Html.Raw("&nbsp;");
                        @:< Prev
                     }
                        &nbsp;
                     @if (Model.HasNextPage)
                     {
                         @Html.ActionLink("Next >", "SearchResult", new { page = Model.PageNumber + 1 })
                         @Html.Raw("&nbsp;");
                         @Html.ActionLink(">>", "SearchResult", new { page = Model.PageCount })
                     }
                     else
                     {
                         @:Next >
                         @Html.Raw("&nbsp;");
                         @:>>
                     }
                    </div>                    
                }

            </div>
        </div>
    </div>
</div>
